//package com.bingbaihanji.springbooth2basedemo.config;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.io.Resource;
//import org.springframework.jdbc.datasource.init.DataSourceInitializer;
//import org.springframework.jdbc.datasource.init.DatabasePopulator;
//import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
//
//import javax.sql.DataSource;
//
//
///**
// * @author 冰白寒祭
// * @date 2023-11-13 10:54:50
// * @description //TODO
// */
//
//@Configuration
//public class CustomizeDataSourceInitializer {
//    @Value("classpath:db/users_schema.sql")
//    private Resource sqlScriptSchema;
//    @Value("classpath:db/users_data.sql")
//    private Resource sqlScriptData;
////    @Value("classpath:sql/procedure.sql")
////    private Resource sqlScriptProcedure;
////    @Value("classpath:sql/function.sql")
////    private Resource sqlScriptFunction;
//
//    @Bean
//    public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {
//        DataSourceInitializer dataSourceInitializer = new DataSourceInitializer();
//        dataSourceInitializer.setDataSource(dataSource);
//        dataSourceInitializer.setDatabasePopulator(databasePopulator());
//        return dataSourceInitializer;
//    }
//
//    private DatabasePopulator databasePopulator() {
//        ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
//        populator.addScript(sqlScriptSchema);
//        populator.addScript(sqlScriptData);
//        populator.setSeparator("$$$"); // 分隔符，默认为;
//        return populator;
//    }
//}
